/*
 * ViewHolder.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * ViewHolder管理Item的UI
 *
 * @deprecated use {@link android.support.v7.widget.RecyclerView.ViewHolder } instead
 */
@Deprecated
public abstract class ViewHolder {

    /**
     * 与当前ViewHolder相关联的DisplayListItem的tag,目前暂时没什么用
     */
    public String tag;

    protected Context mContext;
    private ViewGroup parentView;

    public View inflate(Context context, ViewGroup parent) {
        mContext = context;
        parentView = parent;
        View convertView = LayoutInflater.from(context).inflate(getItemLayoutId(), parent, false);
        initView(convertView);
        return convertView;
    }

    /**
     * 初始化布局
     */
    protected abstract void initView(View rootView);

    /**
     * 当前ViewHolder管理的layoutId
     */
    protected abstract int getItemLayoutId();

    public View getParent() {
        return parentView;
    }
}
